#include "PockerCard.h"

PockerCard::~PockerCard(){
    CCLog("relase %d",cardID);
}

bool PockerCard::init(){
    if(!TPanel::init()){
        return false;
    }
    cardMc=CCSprite::create();
    addChild(cardMc);
    isSelect=false;
    
    maskMc=CCSprite::create("proj/assets/Pokers/cardBack_iPad.png");
    addChild(maskMc,1);
    maskMc->setPositionX(maskMc->getContentSize().width/2);
    maskMc->setPositionY(-maskMc->getContentSize().height/2);
    setContentSize(maskMc->getContentSize());
    return true;
}

void PockerCard::setSelected(){
    if(isSelect){
        isSelect=false;
        setBottom(0);
    }else{
        isSelect=true;
        setBottom(50);
    }
}

void PockerCard::setNum(int num){
    cardID=num;
}


void PockerCard::showNum(){
    char path[50]={0};
     sprintf(path, "proj/assets/Pokers/card_%d_iPad.png",cardID);
     cardMc->initWithFile(path);
     cardMc->setPositionX(cardMc->getContentSize().width/2);
     cardMc->setPositionY(-cardMc->getContentSize().height/2);
    maskMc->setVisible(false);
}